/*
 * cmp.h
 *
 * analog compare driver.
 *
 * Copyright (C) 2022 Microwell, Inc.
 * Subject to the GNU Public License, version 2.
 *
 * Author: guoming<guoming@microwell.net>
 */
#ifndef _CMP_H_
#define _CMP_H_

#include "mcu_regs.h"
#include "types.h"
#include "config.h"
#include "drive.h"

 /*=============================================================================
 *                              CMP config
 *===========================================================================*/
#define CONFIG_CMP_USING_IRQ        (1)
/*=============================================================================
 *                              CMP config end
 *===========================================================================*/

#if (CMP_CHANNEL_MODE == 1)
void cmp_init(void);
void cmp_exit(void);
void cmp_enable(void);
void cmp_disable(void);
bool cmp_is_enable(uint8_t cmp);
void cmp_irq_cb_0(void);
void cmp_irq_cb_1(void);
void cmp_pinmux_get(uint8_t cmp);
void cmp_pinmux_put(uint8_t cmp, bool en);
#if (CONFIG_CMP_USING_IRQ == 1)
bool cmp_irq_is_set(void);
void set_cmp_irq_flag(void);
void clear_cmp_irq_flag(void);
#else
#define cmp_irq_is_set()    (0)
#define set_cmp_irq_flag
#define clear_cmp_irq_flag
#endif
#else
#define cmp_init()
#define cmp_exit()
#define cmp_enable()
#define cmp_disable()
#define cmp_is_enable(cmp)  (0)
#define cmp_irq_cb_0()
#define cmp_irq_cb_1()
#define cmp_pinmux_get(cmp)
#define cmp_pinmux_put(cmp, en)
#define cmp_irq_is_set()    (0)
#define set_cmp_irq_flag()
#define clear_cmp_irq_flag()
#endif
#endif
